feat: add PVC and StorageClass backend API endpoints#905
Conversation
|
/ok-to-test |
eb2d11e to
585ae40
Compare
585ae40 to
e4269ef
Compare
Implements List, Create, and Delete endpoints for PersistentVolumeClaims and a List endpoint for StorageClasses in the backend API. PVC List endpoint includes cross-references to: - Bound PersistentVolume (with StorageClass metadata) - Pods that mount the PVC - Workspaces that reference the PVC (via home or data volumes) Cross-reference collections (pods, workspaces) always serialize as empty arrays `[]` rather than being omitted, matching the pattern used by `services` and `data` on WorkspaceListItem. The `pv` field uses `omitempty` and is omitted when the PVC is unbound. Pod and Workspace cross-references use a list-once-and-map approach (single List call per resource type, then in-memory lookup) rather than per-PVC queries, since Kubernetes does not support field selectors for filtering pods by PVC claim name. Notable: - RBAC includes `persistentvolumes` (get/list/watch) in addition to `persistentvolumeclaims`, since bound PV metadata is resolved for each PVC in the list response. - PVC Create returns an empty Location header because there is no GET-by-name endpoint for PVCs (only list by namespace). - PVC sentinel errors use `errors.New` instead of `fmt.Errorf` (without format verbs), aligning with the workspacekinds repository pattern rather than the workspaces/secrets pattern. - Sample manifests (PVCs, Secret) now include `can-mount` and `can-update` labels so resources created outside the API render correctly in list responses. Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
e4269ef to
2cd172f
Compare
|
/lgtm testing PR with Mathew's contributions and confirm:
|
|
@andyatmiami: you cannot LGTM your own PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@andyatmiami as discussed I pushed some more changes in 5450955 Still need to fix up some tests which now fail because we are being more strict about PVC/StorageClasses existing when creating a Workspace/PVC. |
- fixed tests to ensure all passing - fixed reference to ensure we are using `pvc.Spec.StorageClassName` when getting pvcs - added storageclass data prep to `setup-kind.sh` to facilitate better/more realistic local development Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
|
pulled your changes (thank you!) and fixed up tests and a few other usability issues... your changes /lgtm and i think we can finally move forward with merging this 💯 |
|
Thanks, this is going to make us much closer to release of notebooks V2. /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: thesuperzapper The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
455b333
into
kubeflow:notebooks-v2




closes: #634
closes: #693
closes: #849
Implements List, Create, and Delete endpoints for PersistentVolumeClaims and a List endpoint for StorageClasses in the backend API.
PVC List endpoint includes cross-references to:
Cross-reference collections (pods, workspaces) always serialize as empty arrays
[]rather than being omitted, matching the pattern used byservicesanddataon WorkspaceListItem. Thepvfield usesomitemptyand is omitted when the PVC is unbound.Pod and Workspace cross-references use a list-once-and-map approach (single List call per resource type, then in-memory lookup) rather than per-PVC queries, since Kubernetes does not support field selectors for filtering pods by PVC claim name.
Notable:
persistentvolumes(get/list/watch) in addition topersistentvolumeclaims, since bound PV metadata is resolved for each PVC in the list response.errors.Newinstead offmt.Errorf(without format verbs), aligning with the workspacekinds repository pattern rather than the workspaces/secrets pattern.can-mountandcan-updatelabels so resources created outside the API render correctly in list responses.